# 成员类
from python_test.person import Person

import random


class Member(Person):

    def get(self, red_list):
        while red_list is not None:
            # 考虑异常
            if len(red_list) == 0:
                print("手慢了，红包抢完了")
                return
            # self.price += red_list.pop()
            random_index = random.randint(0, len(red_list) - 1)
            self.price += red_list.pop(random_index)
            print(f"{self.name}抢到了一个{self.price}的红包")
            self.balance += self.price
            return self.balance




